#include <stdio.h>
#include <pthread.h>
#define NUM_THREADS 5
void *print_hello(void *threadid){
	long tid=(long)threadid;
	printf("Hello from thread %ld!\n",tid);
	pthread_exit(NULL);
}
int main(){
	pthread_t threads[NUM_THREADS];
	for(long t=0;t<NUM_THREADS;t++){
		int rc=pthread_create(&threads[t],NULL,print_hello,(void*)t);
		if(rc){
			printf("Error creating thread;code %d\n",rc);
			return 1;
		}
	}
	pthread_exit(NULL);
}
